<?php

use yii\db\Migration;
use yii\db\Schema;

/**
 * Class m181114_064921_ADD_FIELD_INVOICE
 */
class m181114_064921_ADD_FIELD_INVOICE extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->addColumn('{{income}}', 'real_price', Schema::TYPE_DECIMAL. "(10,2) DEFAULT '0.00' COMMENT '实际收入金额' AFTER price ");
        $this->addColumn('{{income}}', 'pro_price', Schema::TYPE_DECIMAL. "(10,2) DEFAULT '0.00' COMMENT '汇款手续费' AFTER real_price ");
        $this->addColumn('{{income}}', 'rate', Schema::TYPE_STRING. "(64) NULL COMMENT '手续费比例 %' AFTER pro_price ");

        $this->addColumn('{{income_claim}}', 'pro_price', Schema::TYPE_DECIMAL. "(10,2) DEFAULT '0.00' COMMENT '汇款手续费' AFTER price ");
        $this->addColumn('{{income_claim}}', 'rate', Schema::TYPE_STRING. "(64) NULL COMMENT '手续费比例 %' AFTER pro_price ");

        $this->addColumn('{{cost}}', 'file_path', Schema::TYPE_STRING. "(256) NULL COMMENT '文件地址' AFTER price ");
        $this->addColumn('{{cost}}', 'file_name', Schema::TYPE_STRING. "(256) NULL COMMENT '原文件名' AFTER file_path ");
        $this->addColumn('{{cost}}', 'file_size', Schema::TYPE_STRING. "(64) NULL COMMENT '文件大小' AFTER file_name ");
        $this->addColumn('{{cost}}', 'file_ext', Schema::TYPE_STRING. "(64) NULL COMMENT '文件扩展名' AFTER file_size ");
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        echo "m181114_064921_ADD_FIELD_INVOICE cannot be reverted.\n";

        return false;
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m181114_064921_ADD_FIELD_INVOICE cannot be reverted.\n";

        return false;
    }
    */
}
